home *** CD-ROM | disk | FTP | other *** search
/ PCGUIA 127 / PC Guia 127.iso / Software / Utils / GParted Live CD / Bin / gparted-livecd-0.2.2.iso / fake / needwrite / etc / rc.d / init.d / udev < prev   
Encoding:
Text File  |  2006-01-27  |  2.0 KB  |  76 lines

  1. #!/bin/sh
  2. # Begin $rc_base/init.d/udev - Udev cold-plugging script
  3.  
  4. # Written by Zack Winkles  - winkie@linuxfromscratch.org
  5.  
  6. . /etc/sysconfig/rc
  7. . $rc_functions
  8.  
  9. # Assure that sysfs is mounted and that udev is present.
  10. [ -d /sys/block -a -x /sbin/udev ] || exit 0
  11.  
  12. # Create some things that sysfs does not, and should not export for us.  Feel
  13. # free to add devices to this list.
  14. make_extra_nodes() {
  15.     ln -s /proc/self/fd /dev/fd
  16.     ln -s /proc/self/fd/0 /dev/stdin
  17.     ln -s /proc/self/fd/1 /dev/stdout
  18.     ln -s /proc/self/fd/2 /dev/stderr
  19.     ln -s /proc/kcore /dev/core
  20.     mkdir /dev/pts
  21.     mkdir /dev/shm
  22. }
  23.  
  24. case "$1" in
  25.     start)
  26.         # Don't attempt to populate the /dev directory when something
  27.         # else has already set it up.
  28.         [ -f /dev/.udev.tdb ] && exit 0
  29.  
  30.         echo -n -e '\E[32mPopulating /dev'
  31.                 echo ""
  32.         # Mount a temporary file system over /dev, so that any devices
  33.         # made or removed during this boot don't affect the next one.
  34.         # The reason we don't write to mtab is because we don't ever
  35.         # want /dev to be unavailable (such as by `umount -a').
  36.         mount -n -t ramfs ramfs /dev
  37.         if [ $? != 0 ]
  38.         then
  39.             print_status failure
  40.             echo -n -e $FAILURE
  41.             echo
  42.             echo "Cannot mount a ramfs onto /dev, this system will be halted."
  43.             echo
  44.             echo -n "When you press Enter, this system will be halted."
  45.             echo -n -e $NORMAL
  46.             echo
  47.             echo "Press Enter to continue..."
  48.             read ENTER
  49.  
  50.             halt -f
  51.         fi
  52.  
  53.         # Assign udev to get hotplug events.  This will be overwritten
  54.         # in the hotplug bootscript.
  55.  
  56.         # Populate /dev with all the devices that are already available,
  57.         # and save it's status so we can report failures.
  58.         udevstart || failed=1
  59.  
  60.         # Now, create some required files/directories/devices that sysfs
  61.         # doesn't export for us.
  62.         make_extra_nodes
  63.  
  64.         # When reporting the status, base it on the success or failure
  65.         # of the `udevstart' command, since that's the most important.
  66.         (exit $failed)
  67.         #evaluate_retval
  68.         ;;
  69.     *)
  70.         echo "Usage $0 {start}"
  71.         exit 1
  72.         ;;
  73. esac
  74.  
  75. # End $rc_base/init.d/udev
  76.